﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="template.aspx.cs" Inherits="weikeweixin.web.admin.website.template" %>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="Keywords" content="IdeaSoft软件" />
        <meta name="Description" content="IdeaSoft软件二维码" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/bootstrap.min.css?v=<%=Application["v"] %>" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/bootstrap.responsive.min.css?v=<%=Application["v"] %>" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/style.css?v=<%=Application["v"] %>" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/themes.css?v=<%=Application["v"] %>" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/todc_bootstrap.css?v=<%=Application["v"] %>" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/inside.css?v=<%=Application["v"] %>" />
    <link href="/css/Bootstrap/official.css?v=<%=Application["v"] %>" rel="stylesheet"type="text/css" />


    <script type="text/javascript" src="/Scripts/JQuery.min.js?v=<%=Application["v"] %>"></script>
    <script type="text/javascript" src="/Scripts/JQuery.cookie.js?v=<%=Application["v"] %>"></script>
    <script type="text/javascript" src="/Scripts/JQuery.form.min.js?v=<%=Application["v"] %>"></script>
    <script type="text/javascript" src="/Scripts/JQuery.form.wizard.min.js?v=<%=Application["v"] %>"></script>
    <script type="text/javascript" src="/Scripts/Inside.js?v=<%=Application["v"] %>"></script>

<title>IdeaSoft软件</title>
    </head>
    <body class="theme-satgreen">
    <div id="main">
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12">
                    <div class="box">
                        <div class="box-title">
                            <div class="span12">
                                <h3><i class="icon-edit"></i>模板管理</h3>
								<a class="btn preview pull-right btn-success" href="javascript:;">官网预览</a>
                                <script type="text/javascript">
                                    $("a.preview").click(function () {
                                        if ($.browser.msie) {
                                            alert("不支持在IE浏览器下预览，建议使用谷歌浏览器或者360极速浏览器或者直接在微信上预览。");
                                            return;
                                        }

                                        var top = ($(window.parent.parent).height() - 480) / 2;
                                        var left = ($(window.parent.parent).width() - 320) / 2;
                                        var previewUrl = "http://" + window.location.host + "/phone/home?userid=" + "<%=user_id %>";

                                        window.open(previewUrl, "我的微官网", "height=480,width=320,top=" + top + ",left=" + left + ",toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no");
                                    });
                                </script>
                            </div>
                        </div>
                        <div class="box-content">
                            <ul class="nav nav-tabs">
                                <li class="active"><a href="#column" data-toggle="tab">栏目首页模板选择</a></li>
                                <li><a href="#color" data-toggle="tab" style="display:none;">颜色选择</a></li>
                            </ul>
                            <div class="tab-content">
								<div class="tab-pane fade active in" id="column">
									                                    <ul class="cateradio unstyled" id="templist">
																		</ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script src="/Scripts/Su.common.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        var url = "template.aspx";
        var Template = "<%=Template %>";

        $.ajax({
            url: url + "?action=templatelist",
            type: "post",
            success: function (msg) {
                msg = eval("(" + msg + ")");
                var str = "";
                for (var i = 0; i < msg.length; i++) {
                    str += '<li ' + (msg[i].Tid == Template ? 'class="active"' : '') + '><div class="mbtip">' + msg[i].TComment + '</div>';
                    str += '<label><img src="' + msg[i].TPicUrl + '" alt="' + msg[i].TName + '" title="' + msg[i].TName + '"/>';
                    str += '<input type="radio" name="home" value="' + msg[i].Tid + '" ' + (msg[i].Tid == Template ? "checked=checked" : "") + '>';
                    str += '<span style="font-weight:bold;">' + msg[i].TName + '</span></label></li>';
                }

                $("#templist").html(str);
                $("div.tab-pane input[type='radio'] ").click(function () {
                    var $this = $(this), $key = $this.attr("name"), $value = $this.val();
                    var _pli = $this.parents("li");
                    _pli.siblings().removeClass("active")
                    _pli.addClass("active");
                    $.post('template.aspx?action=bindtemp', { key: $key, value: $value }, function (rs) {
                        if (200 != rs.code) {
                            G.ui.tips.err(rs.error);
                        }
                    }, 'json');
                })
            }
        });
    });

    window.document.onkeydown = function (e) {
        if ('' == document.activeElement.id) {
            var e = e || event;
            var currKey = e.keyCode || e.which || e.charCode;
            if (8 == currKey) {
                return false;
            }
        }
    };
</script>
</html>
